﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo
{
    class Program
    {
        static void Main(string[] args)
        {
            test5();

        }
        public static void test1() {
            //1、音乐老师（既是老师，又是运动员），需要有一种结构，音乐老师继承老师，同时继承运动员。
            //程序员（既是员工，又是作家），需要有一种结构，程序员继承员工，同时继承作家。
            Teacher p1 = new Teacher("英语","李四");
            p1.print();
            p1.Ires();

            ProgramMoney p2 = new ProgramMoney("员工","张三");
            p2.print();
            p2.Ires();
        }
        public static void test2() {
            //2、猫、狗、鸭、猴，（吃、游泳、爬树）

            cat cat = new cat();
            dog dog = new dog();
            duck duck = new duck();
            Money money = new Money();

            TestIswim(dog);
            TestIclimb(cat);

            TestAnimal(cat);
            TestAnimal(dog);

            Animal a = cat; //>=<
            cat = (cat)a;   //<=>

        }

        public static void test3() {
            //3、蝙蝠战车的例子
            BMWCar bmwCar1 = new BMWCar("宝马", "750");
            bmwCar1.run();

            BMWCar bmwCar2 = new BMWCar("宝马", "X5");
            bmwCar2.run();

            Batman batCar = new Batman("蝙蝠战车", "第一代");
            batCar.run();
            batCar.fly();
        }
        public static void test4() {
            //4、子类：飞机、小鸟、超人
            //父类：交通工具、动物
            //接口
            superman s1 = new superman();
            s1.eat();
            s1.fly();
            s1.land();
            s1.takeoff();

            bird b1 = new bird();
            b1.takeoff();
            b1.layEggs();
            b1.land();
            b1.fly();

            plane p1 = new plane();
            p1.fly();
            p1.land();
            p1.takeoff();
            p1.carryPassange();
        }
        public static void test5() {
            //USB
            UDisk u1 = new UDisk("铠侠64G");
            u1.read();
            u1.write();

            Console.WriteLine();

            MobileHardDisk m1 = new MobileHardDisk("三星500G");
            m1.read();
            m1.write();

            Console.WriteLine();

            ComputerAndUSB l1 = new ComputerAndUSB("神舟");
            l1.start();
            l1.usb1 = u1;
            l1.usb2 = m1;

            l1.ReadData();
            l1.WriteData();

            l1.end();

        }
        public static void TestIswim(Iswim swim) {
            swim.swim();
        }
        public static void TestIclimb(Iclimb climb)
        {
            climb.climb();
        }
        public static void TestAnimal(Animal a)
        {
            a.eat();
        }
    }
}
